<!DOCTYPE html>
<html>
    <head>
    </head>
    <body>
    <pre id=message></pre>
    <script>
        const closed = (message) => {
            console.log(message);
            document.getElementById('message').innerHTML = `Message: "${message}"\n`;
        };

        setTimeout(() => { console.log('This must not appear until after the prompt is closed.'); }, 1000);
        closed(prompt("Hello friends!"));
    </script>
    </body>
</html>
